package io.renren.modules.store.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.annotation.NoRepeatSubmit;
import io.renren.modules.store.entity.TStoreAccountListEntity;
import io.renren.modules.store.service.TStoreAccountListService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.store.entity.TStoreAccountDetailEntity;
import io.renren.modules.store.service.TStoreAccountDetailService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author steakliu
 * @email 2319492349@qq.com
 * @date 2021-05-04 23:08:10
 */
@RestController
@RequestMapping("store/tstoreaccountdetail")
public class TStoreAccountDetailController {
    @Autowired
    private TStoreAccountDetailService tStoreAccountDetailService;
    @Autowired
    private TStoreAccountListService storeAccountListService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tStoreAccountDetailService.queryPage(params);

        return R.ok().put("page", page);
    }

    /**
     * 获取结账明细
     * @param
     * @return
     */
    @RequestMapping("/getDetailList")
    public R getDetailList(@RequestParam Map<String,Object> params){
        PageUtils page = storeAccountListService.queryPage2(params);
        return R.ok().put("page",page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		TStoreAccountDetailEntity tStoreAccountDetail = tStoreAccountDetailService.getById(id);

        return R.ok().put("tStoreAccountDetail", tStoreAccountDetail);
    }

    /**
     * 保存
     */
    @NoRepeatSubmit
    @RequestMapping("/save")
    public R save(@RequestBody TStoreAccountDetailEntity tStoreAccountDetail){
		tStoreAccountDetailService.save(tStoreAccountDetail);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody TStoreAccountDetailEntity tStoreAccountDetail){
		tStoreAccountDetailService.updateById(tStoreAccountDetail);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		tStoreAccountDetailService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
